package org.xxx.mybatis.config;

import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.xxx.mybatis.base.DemoService;
import org.xxx.mybatis.prop.MybatisPlusProperties;

@AllArgsConstructor
@Configuration
@EnableConfigurationProperties(MybatisPlusProperties.class)
@ConditionalOnProperty(
        prefix = "xxx",
        name = "mybatis",
        havingValue = "true"
)
public class MybatisPlusConfiguration {

    private final MybatisPlusProperties properties;

    @Bean
    public DemoService demoService() {
        return new DemoService(properties.getHello(), properties.getHello() + "123");
    }


}
